	<include file='Common:header' />

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">

			<!-- #section:basics/sidebar -->

	<include file='Common:left' />


			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">

                        
                        
                        <!--主题-->
						<div class="page-header">
							<h1>
								您当前操作
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									添加友情链接
								</small>
							</h1>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<form class="form-horizontal" name="columnadd" id="columnadd" method="post" action="{:U('add_link_run')}">
                                
                                	<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 机构名称 </label>
										<div class="col-sm-9">
											<input type="text" name="name" id="name"  placeholder="必填：机构名称"  class="col-xs-10 col-sm-5" />
                                            <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle" id="resone1"></span>
											</span>
										</div>
									</div>
                                    <div class="space-4"></div>
                                

									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 链接地址 </label>
										<div class="col-sm-9">
											<input type="text" name="link_url" id="link_url" class="col-xs-10 col-sm-5" placeholder="点击机构名称跳转的网址" />
											<span class="help-inline col-xs-12 col-sm-7">
												<span class="middle" id="resone2"></span>
											</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 展示排序 </label>
										<div class="col-sm-9">
											<input type="text" name="sort" id="sort" class="col-xs-10 col-sm-5" placeholder="从小到大" />
											<span class="help-inline col-xs-12 col-sm-7">
												<span class="middle" id="resone3"></span>
											</span>
										</div>
									</div>
                                    <div class="space-4"></div>

    						
                                    
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" type="submit">
												<i class="ace-icon fa fa-check bigger-110"></i>
												保存
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" type="reset">
												<i class="ace-icon fa fa-undo bigger-110"></i>
												重置
											</button>
										</div>
									</div>
								</form>
                        	</div>
                        </div>
									<div class="hr hr-24"></div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

	<include file='Common:footer' />

<script>
$(function(){
	$('#columnadd').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		if( '' == $.trim($('#name').val())){
			$('#resone1').attr("class", "middle highmsg");//ID为resone 重新class赋值
			$('#resone1').html('机构名称不能为空').show();//id为resone 赋值html值
			$('#name').focus(); 
			return false;
		}
		if( '' == $.trim($('#link_url').val())){
			$('#resone2').attr("class", "middle highmsg");//ID为resone 重新class赋值
			$('#resone2').html('链接地址不能为空').show();//id为resone 赋值html值
			$('#link_url').focus(); 
			return false;
		}
		if( '' == $.trim($('#sort').val())){
			$('#resone3').attr("class", "middle highmsg");//ID为resone 重新class赋值
			$('#resone3').html('请添加排序').show();//id为resone 赋值html值
			$('#sort').focus(); 
			return false;
		}
 }
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			alert(data.info);
			return false;	
		}
	}
 
});
</script>

		</div><!-- /.main-container -->
	</body>
</html>
